import 'package:flutter/material.dart';
import '../model/category.dart';


class ChildCategory with ChangeNotifier{
  List<BxMallSubDto> childCategoryList = [];
  int childIndex = 0; // 右侧二级类别,默认为全部
  String categoryId = '4'; // 大类Id
  int page = 1;  // 页数
  String noMoreText = ''; // 显示数据到底的文字
  String categorySubId = ''; // 二级类id
  getChildCategory(List<BxMallSubDto> list,String id){
    BxMallSubDto all = BxMallSubDto();
    all.mallSubId = '';
    all.mallCategoryId = id;
    all.mallSubName = '全部';
    all.comments = null;
    childCategoryList = [all];
    childCategoryList.addAll(list);
    notifyListeners();
  }

  changeChildIndex(index){
    page = 1;
    noMoreText = '';
    childIndex = index;
    notifyListeners();
  }
  // 大类Id
  changeCategoryId(id){
    page = 1;
    noMoreText = '';
    categoryId = id;
    notifyListeners();
  }

  // 页面设置 page = 1
  changPage(){
    page = 1;
    notifyListeners();
  }

  //设置二级分类Id
  changCategorySubId(id){
    page = 1;
    categorySubId = id;
    notifyListeners();
  }

  // 页面增加
  addPage(){
    page++;
    notifyListeners();
  }

  // 改变底部文字
  changeNoMore(String text){
    noMoreText = text;
    notifyListeners();
  }
}